FRIENDS_D = {}

---! 获取好友列表
function FRIENDS_D:C2SGetFriends(user_ob, msg)
    local steam_ids = msg.steam_id
    local friends = {}
    if "table" ~= type(steam_ids)  then
        spdlog.error("C2SGetFriends msg","table ~= type(steam_ids)")
        return
    end

    for _, steam_id in ipairs(steam_ids) do
        local u_ob = USER_D:load_user_by_steam_id(steam_id)

        local one = {}
        one.steam_id = steam_id
        
        if not u_ob then
            one.user_id = 0
            one.level = 0
            one.status = 0 --离线
        else
            one.user_id = u_ob:get_id()
            one.level = u_ob:get_level()
            if u_ob:get_agent() then --有登录
                one.status = (u_ob:is_in_room() or u_ob:is_in_combat()) and 2 or 1 --1空闲(在大厅) 2游戏战斗中
            else
                one.status = 0
            end
        end 
        table.insert(friends, one)
    end
    local result = {}
    result.friends = friends
    user_ob:send_packet("tanker.S2CGetFriends", result)
end
